<template>
	<view class="content">
		<!-- <view style="width: 100%; height: 80rpx; border: none; display: flex; justify-content: space-between; align-items: center; background-color: #fa341b">
			<view style="margin-left: 20rpx; color: #ffffff" @click="fanhui"> &lt </view>
			<view style="color: #ffffff; font-size: 30rpx; font-weight: 800; margin-right: 290rpx"> 抽成比例 </view>
		</view> -->
		<view class="kkk"></view>
		<view class="topp">
			<div class="top-text">
				<h3>抽成比例调整</h3>
				<p>根据需求调整抽成比例，调整区间1%-99%</p>
				<p>当前抽成比例为{{ scale }}%</p>
			</div>
			<view style="width: 400rpx; margin: 0 auto; border-bottom: 1rpx solid #F5F5F5; red;padding-top: 30rpx;display: flex; ">
				<p style="font-size: 24rpx">百分之</p>
				<input type="text" v-model="bili" placeholder="请输入抽成比例" style="font-size: 24rpx; margin-left: 10rpx; margin-top: 7rpx" />
			</view>
		</view>
		<view class="wancheng" @click="setScal">确认</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			lid: 0,
			scale: "",
			bili: "",
		};
	},
	onLoad(e) {
		console.log("e :>> ", e);
		e && (this.lid = e.lid);
		this.getRake();
		uni.setNavigationBarColor({
			frontColor: "#ffffff",
			backgroundColor: "#FE3548",
			animation: {
				duration: 400,
				timingFunc: "easeIn",
			},
		});
	},
	methods: {
		fanhui() {
			wx.switchTab({
				url: "../me_a",
			});
		},
		async getRake() {
			let obj = {
				uid: uni.getStorageSync("uid"),
				lid: this.lid,
			};
			const res = await this.$u.post("api/task/task_team_sel", obj, {});
			if (!res.code) return uni.$showMsg();
			this.scale = res.data.scale;
			console.log("res >>  ", res);
		},
		async setScal() {
			if (!this.bili) return uni.$showMsg("请填写下比例之后再提交!");
			let obj = {
				uid: uni.getStorageSync("uid"),
				lid: this.lid,
				scale: this.bili,
			};
			const res = await this.$u.post("api/task/task_team", obj, {});
			uni.$showMsg(res.msg);
			this.bili = "";
			this.getRake();
			console.log("res >>  ", res);
		},
	},
};
</script>

<style lang="scss" scoped>
.content {
	width: 100%;
	height: 100vh;
	background-color: #f5f8fd;
}
.kkk {
	width: 100%;
	height: 20rpx;
}
.topp {
	width: 690rpx;
	background-color: #ffffff;
	margin-left: 30rpx;
	border-radius: 10rpx;
	padding: 20rpx 0;
}
.wancheng {
	width: 690rpx;
	height: 80rpx;
	line-height: 80rpx;
	background-color: #fa341b;
	color: #ffffff;
	text-align: center;
	margin-left: 30rpx;
	margin-top: 20rpx;
	border-radius: 10rpx;
	font-size: 32rpx;
}

.top-text {
	text-align: center;
	p {
		margin-top: 15rpx;
	}
}
</style>
